ARD2  1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
SM.c File Reference

State machine basic functionality. More...

#include "derivative.h"
#include "compile_options.h"
#include "HAL.h"
#include "SM.h"
#include "Application_Globals.h"

Functions

uint32_t u32fnSMLaunch (void)
 Launches the State Machine and loops forever from one state to the next.
void vfnSMWriteNextState (uint16_t u16NextState)
 Writes the next state to gu16SMCurrentState[1]; Keeps the past state as the current one to gu16SMCurrentState[0].
uint32_t u32fnSMValidateCurrentState (uint16_t *pu16ValidStateList, uint16_t u16Size)
 Function used in each state to validate if the reason we got here is valid.

Variables

uint32_t(*const u32pfnState [])(void)
uint16_t gu16SMCurrentState [2u]
uint32_t gu32SMStateStatus

Detailed Description

State machine basic functionality.

Copyright (C) 2011 Freescale Semiconductor Freescale Confidential Proprietary

Author:
Freescale Semiconductor
SASD Automotive
r11515
Version:
Date:
Warning:
(If needed)

History:


Function Documentation

uint32_t u32fnSMLaunch ( void  )

Launches the State Machine and loops forever from one state to the next.

Parameters:
None
Returns:
u32Status: Always zero. This function should never exit.
uint32_t u32fnSMValidateCurrentState ( uint16_t *  pu16ValidStateList,
uint16_t  u16Size 
)

Function used in each state to validate if the reason we got here is valid.

Parameters:
pu16ValidStateList,:a pointer to an array with a list of valid source states.
u16Size,:Size of the table in pu16ValidStateList.
Returns:
u32Status: Clear if it is a valid source; SM_STATE_IS_EXECUTING if this state was entered while another one was already executing; SM_INVALID_SOURCE_STATE if the source state is not in the pu16ValidStateList.
void vfnSMWriteNextState ( uint16_t  u16NextState)

Writes the next state to gu16SMCurrentState[1]; Keeps the past state as the current one to gu16SMCurrentState[0].

Parameters:
u16NextState,:the index to the next state.
Returns:
void

Variable Documentation

uint16_t gu16SMCurrentState[2u]

Array that holds the current state, and the previous one as well. Previous state is held in position 0, current state is held in position 1.

Global state for the state machine

uint32_t(* const u32pfnState[])(void)
Initial value:

The element below is a constant array of pointers to functions where